/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import javaapplication1.GUI.JFrameCopiador;

/**
 *
 * @author Educacionit
 */
public class Copiador {

    public static void copiarTextosAArchivos() throws IOException {
        JFrameCopiador copiador = new JFrameCopiador();
        File file1 = new File(copiador.entrada);
        File file2 = new File(copiador.salida);
        FileReader fileReader = null;
        FileWriter fileWriter = null;
        BufferedReader in = null;
        BufferedWriter out = null;
        try {
            fileReader = new FileReader(file1);
            fileWriter = new FileWriter(file2);
            in = new BufferedReader(fileReader);
            out = new BufferedWriter(fileWriter);
            String cadena = "";
            while (in.ready()) {
                cadena = in.readLine();
                for (int i = 0; i < cadena.length(); i++) {
                    out.write(cadena.charAt(i));
                }
                out.newLine();
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            in.close();
            fileReader.close();
            out.close();
            fileWriter.close();
        }
    }

    public static void main(String[] args) throws IOException {

        copiarTextosAArchivos();


    }


}
